package com.ghh.swing;

import java.awt.Color;
import java.awt.Dimension;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import java.awt.Insets;

import java.awt.Rectangle;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class TestPanel extends JPanel {
    private GridBagLayout gridBagLayout1 = new GridBagLayout();
    private JPanel jPanel1 = new JPanel();
    private JPanel jPanel2 = new JPanel();
    private JButton jButton1 = new JButton();

    public TestPanel() {
        try {
            jbInit();
            this.setVisible(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setLayout(gridBagLayout1);
        this.setSize(new Dimension(963, 541));
        this.setBackground(new Color(93, 108, 237));
        jPanel1.setLayout(null);
        jPanel1.setBackground(new Color(144, 237, 129));
        jPanel1.setMinimumSize(new Dimension(30, 100));
        //jPanel1.setSize(new Dimension(200, 100));
        jPanel1.setPreferredSize(new Dimension(30, 100));
        jPanel2.setBackground(new Color(237, 90, 222));
        jButton1.setText("jButton1");
        jButton1.setBounds(new Rectangle(175, 20, 85, 35));
        jPanel1.add(jButton1, null);
        this.add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                    new Insets(0, 0, 0, 0), 0, -18));
        this.add(jPanel2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
                    new Insets(0, 0, 0, 0), 1, 0));
    }
    
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    JFrame frame = new JFrame();
                    TestPanel tp = new TestPanel();
                    frame.add(tp);
                    frame.setSize(500, 300);
                    frame.setVisible(true);
                    
                }
            });
    }
}
